import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import javax.sql.DataSource;


@Configuration
public class AppConfig {

    @Bean
    public DataSource dataSource(){
        DriverManagerDataSource d = new DriverManagerDataSource() ;
        d.setUrl("jdbc:mysql://localhost:3306/test?serverTimezone=UTC"); //设置url
        // 上述的test为你的数据库名
        d.setUsername("hsp"); //设置账号
        d.setPassword("123"); //设置密码
        return d;
    }

}


